package cn.itsource.basic.task;

import cn.itsource.basic.task.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.Schedules;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
* 定时提醒类
* @author wangcp
* @date 2021/05/08 18:04
**/
@Component
public class TimingRemindTask {

    @Autowired
    private TaskService taskService;

//    @Schedules({@Scheduled(cron = "0 15 11,14,16 * * ? "),@Scheduled(cron = "0 0 18 * * ? ")})
    @Schedules({@Scheduled(cron = "0/5 * * * * ? ")})
    public void remindTask(){
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

//        System.out.println("执行定时任务了,执行时间为：" + sdf.format(new Date()));

        taskService.executeRemindMessage();

    }
}
